package cn.hy.transaction;

import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.support.TransactionTemplate;

public class Config {

    public TransactionTemplate TransactionTemplate(PlatformTransactionManager platformTransactionManager) {
        TransactionTemplate template = new TransactionTemplate();
        template.setIsolationLevel(TransactionDefinition.ISOLATION_DEFAULT);
        template.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
        template.setTransactionManager(platformTransactionManager);
        return template;
    }
}
